//
//  ViewController.m
//  24-加密
//
//  Created by mafeng on 16/8/16.
//  Copyright © 2016年 mafeng. All rights reserved.
//

#import "ViewController.h"
#import "NSString+MFMD5.h"
#import "NSString+MFSHA_1.h"
#import "NSString+MFBase64.h"
#import "NSString+MFDES.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    // MD5 SHA_1 单项散列函数, 算法
    // 1. MD5 验证算法 一般应用在验证密码
    NSString *afterMD5 = @"hello";
    NSString *final32BitLower = [afterMD5 stringWith32BitMD5Lower];
    NSString *final32BitUpper = [afterMD5 stringWith32BitMD5Upper];
    NSString *final16BitLower = [afterMD5 stringWith16BitMD5Lower];
    NSString *final16BitUpper = [afterMD5 stringWith16BitMD5Upper];
    
    NSLog(@"32 bit 小写:%@", final32BitLower);
    NSLog(@"32 bit 大写:%@", final32BitUpper);
    NSLog(@"16 bit 小写:%@", final16BitLower);
    NSLog(@"16 bit 大写:%@", final16BitUpper);

    
    // 2. SHA_1
    NSString *afterSHA_1 = @"HELLO";
    NSString *finalSHA_1 = [afterSHA_1 stringWithSHA_1];
    NSLog(@"%@", finalSHA_1);
    
    
    // 3. base64
    NSString *afterBase = @"HELLO, 卡死的房间爱立方的骄傲而拉法律纠纷爱上方法就伐开森按时但是";
    NSString *finalBase = [afterBase stringWithBase64];
    NSLog(@"%@", finalBase);
    
    NSString *orginString = [finalBase base64WithString];
    NSLog(@"%@", orginString);
    
    // 4. 对称密码
    // 三种 算法 DES 三重DES AES
    NSString *string = @"123456789";
    NSString *desString = [string stringWithDES];
    NSLog(@"%@", desString);
    
    
    NSString *desStr = [desString desWithString];
    NSLog(@"%@", desStr);
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
